module MC.View {
	export class Zhaopin_yplist {
		public constructor() {
		 	this.init();
		}
		private init() {
			var list = new MC.Page("#zhaopin_yplist", 'zhaopin_yplist', { id: MC.get('id') },
				(resData: any, page: any) => {
					//console.log(resData,page);
					for(let i=0;i<resData.length;i++){
						this.addli(resData[i]);
					}
				});
			list.init();
			$('#zhaopin_yplist').on('click','[yingpin] .tuihui',function(){
				let one=$(this).parents('[yingpin]');
				let yingpinid=one.attr('yingpin');
				let uid=one.attr('uid');
				MC.msg.confirm('是否退回改投递?该操作无法撤销.',()=>{
					console.log(yingpinid,uid);	
					MC.api('jobtuihui',{id:yingpinid},()=>{
					 	location.reload();
					});
				});
				
			});
			$('#zhaopin_yplist').on('click','[yingpin] .tongzhi',function(){
				let one=$(this).parents('[yingpin]');
				let yingpinid=one.attr('yingpin');
				let uid=one.attr('uid');
				MC.msg.confirm('是否通知该求职者?',()=>{
					console.log(yingpinid,uid);	
					MC.api('jobyingpin',{id:yingpinid},()=>{
					 	location.reload();
					});
				}); 
			});
		}
		private addli(li:any){
			console.log(li);
			let html=`<li class="li status_code`+li.status_code+`" yingpin="`+li.id+`" uid="`+li.uid+`">
                <div class="userinfo clearfix">
                    <img class="head" src="`+li.user.head+`"  />
                    <div class="namediv">
                       
					    <p class="name">
					    <span class="span">`+li.user.name+`</span>
					    <span class="lianxi" call="`+li.jiguang_id+`">在线联系</span>
					    
					    </p>
                       <a class="jianlidiv clearfix" href="/h5/index/staffShow.html?id=`+li.uid+`">
					   	 <i class="jianli jianliIco"></i>
							<span class="span">查看简历</span>
					   </a>
                    </div>
                </div>
                <div class="infoli clearfix">
                    <span class="spanlable">学历</span>
                    <span class="value education">`+li.user.education+`</span>
                </div>
                <div class="infoli clearfix">
                    <span class="spanlable">姓名</span>
                    <span class="value xingming">`+li.user.xingming+`</span>
                </div>
                <div class="infoli clearfix">
                    <span class="spanlable">性别</span>
                    <span class="value sex">`+li.user.sex+`</span>
                </div>
                <div class="infoli clearfix">
                    <span class="spanlable">期待月薪</span>
                    <span class="value salary">¥`+li.user.salary+`元</span>
                </div>
                <div class="infoli clearfix">
                    <span class="spanlable">状态</span>
                    <span class="value status">`+li.status+`</span>
                </div>
                <div class="infoli clearfix">
                    <span class="spanlable">投递时间</span>
                    <span class="value created_at">`+li.created_at+`</span>
                </div>
                <div class="infoli caozuo clearfix">
                    <span class="spanlable">操作</span>
                    <div class="value">
                        <a call="`+li.jiguang_id+`" class="button lianxi">发送消息</a>
                        <a class="button tuihui">退回简历</a>
                        <a class="button tongzhi">通知应聘</a>
                    </div>

                </div>
            </li>`;
			$('.zhaopin_yplistUl').append(html);
		}
	}
}